package com.weihoo.manager.config;

import com.weihoo.manager.service.IHelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.caucho.HessianProxyFactoryBean;
import org.springframework.remoting.caucho.HessianServiceExporter;
import org.springframework.remoting.rmi.RmiServiceExporter;

/**
 * @Author houyeping
 * @Date 2017/11/24 16:41
 * @Description
 */
@Configuration
public class HessianConfig {

    /*@Autowired
    private ApplicationContext context;*/

    @Bean
    public HessianProxyFactoryBean hessianProxyFactoryBean(){
        HessianProxyFactoryBean hessianProxyFactoryBean = new HessianProxyFactoryBean();
        hessianProxyFactoryBean.setServiceUrl("http://localhost:8000/helloService");
        hessianProxyFactoryBean.setServiceInterface(IHelloService.class);
        hessianProxyFactoryBean.setConnectTimeout(5000);//连接超时
        hessianProxyFactoryBean.setReadTimeout(3000);//读取超时
        return hessianProxyFactoryBean;
    }

}
